package service;

import beans.User;
import dao.adminDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class adminServiceImpl implements adminService {
    @Autowired
    private adminDao adminDao;

    @Override
    public void addUser(User user) {
        adminDao.addUser(user);
    }

    @Override
    public List<User> selectUsers() {
        return adminDao.selectUsers();
    }

    @Override
    public User selectUserById(Integer userId) {
        return adminDao.selectUserById(userId);
    }

    @Override
    public void deleteUserById(Integer userId) {
        adminDao.updateUserSuperId(userId);
        adminDao.deleteUserById(userId);
    }

    @Override
    public void addUserSuperId(Integer super_id,Integer userId) {
        adminDao.addUserSuperId(super_id,userId);
    }
}
